<%@page import="front.PM"%>
<%@page import="front.Post"%>
<%@page import="front.Thread"%>
<%@page import="front.SubForum"%>
<%@page import="java.util.ArrayList"%>
<%@page import="be.db_backend"%>
<%@page import="mt.middle"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
	middle m = new middle(new db_backend());
	ArrayList<front.User> users = m.getAllUsers();
	ArrayList<SubForum> subForum = m.getAllSubForums();
	ArrayList<front.Thread> threads = new ArrayList<front.Thread>();
	ArrayList<Post> posts = new ArrayList<Post>();
	
	for(front.User u : users){
		out.println(u.toString());
	}
	
	out.println("<p>Subforums!</p>");
	for(SubForum s : subForum){
		out.println("<div><font color='red'>"+s.getName() +"	" + s.getNumberOfThreads()+"</font><br>");
		threads = m.getAllThreads(s.getSubForumID());
		if(threads != null){
			for(Thread t : threads){
				out.println("<p><font color='green'>&nbsp&nbsp&nbsp&nbsp" + t.getName() + " " + t.getReplies() + " " + t.getViews() + "</font></p>");
				posts = t.getAllPosts();
				if(posts != null){
					for(Post p : posts){
						out.println("<p><font color='blue'>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+ p.getUserNameOfCreator()+ ": "+p.getContent()+ "</font></p>");	
					}
				}
			}
		}
		out.println("</div>");
	}
	
	
%>
</body>
</html>